import { lazy } from 'react'//路由是react
import { FriendsO, HomeO, Search, SettingO } from '@react-vant/icons'
import * as  type from '../utils/index'
//第一步
//第五部  展示内容

export const RouterHomes: type.Data_List = [//二级
    {
        path: "/home/index",
        element: lazy(() => import('../page/home/Index')),
        title: "首页",
        icon: <HomeO />
    },
    {
        path: "/home/cart",
        element: lazy(() => import('../page/home/Cart')),
        title: "购物车",
        icon: <FriendsO />
    },
    {
        path: "/home/user",
        element: lazy(() => import('../page/home/User')),
        title: "地址",
        icon: <SettingO />
    },
    {
        path: "/home/my",
        element: lazy(() => import('../page/home/My')),
        title: "我的",
        icon: <Search />
    }
]
//一级
export const routes: type.Data_List = [
    {
        path: "/",
        //to重定向
        to: "/login"

    },
    {
        path: "/home",
        element: lazy(() => import('../page/Home')),
        children: RouterHomes
    },
    {
        path: "/login",
        element: lazy(() => import('../page/Login')),
    },
    {
        //                                  * 表示 404
        path: "*",
        element: lazy(() => import('../page/Error')),
    }
]

export default routes